
Chapter 11. Detecting User Input (Signals)

From:
   Windows Programming Using Java
   Gayathri Singh and Andrew Davison

Contacts: 
  Gayathri Singh
  support@jinvoke.com 

and

  Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat Yai, Songkhla 90112, Thailand
  E-mail: ad@fivedots.coe.psu.ac.th

  Web Site for the book:
     http://fivedots.coe.psu.ac.th/~ad/winJava/


If you use this code, please mention our names, and include links
to the book's Web site.

Thanks,
  Gayathri and Andrew


============================
Detecting User Input: Signals

The files and directories are: 

* compile.bat, run.bat   
     // batch files for compiling and running most of the examples;
     // they utilize J/Invoke (see below)

* SignalsWin.java, SignalsJIWin.java


Compilation and Execution
=========================

There are two programs to try out:


1) This example uses Sun's non-standard sun.misc.Signal and SignalHandler.

> javac SignalsWin.java
     /* javac will print 8 warnings, saying that sun.misc.SignalHandler 
        and Signal are Sun proprietary API classes and may be removed in the
        future. Ignore these warnings; the code will still run.  */

> java SignalsWin
     // try to close and terminate the application with ctrl-c's
     // the way to finish it off is via Window's Task Manager

----------------------------------------
2)

> compile SignalsJIWin.java
      /*  The core dump report can be changed by editing the signalsHandler()
          method in SignalsJIWin.java so that the WinConstants.CTRL_BREAK_EVENT 
          case statement calls printStackTrace() or printThreads().  */

> run SignalsJIWin 
     // try to close and terminate the application with ctrl-c's
     // the way to finish it off is via Window's Task Manager
     // ALSO type ctrl-break to get a core dump report


-------
J/Invoke

A 30-day evaluation version of J/Invoke can be downloaded from
http://www.jinvoke.com/download. Unzip it and store in a directory.

The batch files in this directory (compile.bat and run.bat) assume 
that jinvoke.jar is located in d:\jinvoke\

---------
Last updated: 13th June 2008
